﻿/**
 * Router Beta AS3 Framework
 * @version 1.0
 * @since 2010
 */
package com.routerbeta.net.events
{
	import flash.events.Event;
	
	/**
	 * Eventos dos objetos FileLoader e FileUploader.
	 * @version 1.0
	 * @since 17/02/2010
	 * 
	 * @author Will Soares @ willsoares.com
	 */
	public class FileEvent extends Event
	{
		/** . */
		public static const SELECT			:String = "select";
		/** . */
		public static const CANCEL			:String = "cancel";
		/** . */
		public static const LOADED			:String = "loaded";
		/** . */
		public static const UPLOADED		:String = "uploaded";
		/** . */
		public static const PROGRESS		:String = "progress";
		/** . */
		public static const INIT			:String = "init";
		/** . */
		public static const OPEN			:String = "open";
		
		/**
		 * 
		 */
		public function get fileName():String
		{
			return _fileName;
		}
		private var _fileName:String;
		
		/**
		 * 
		 */
		public function get progress():Number
		{
			return _progress;
		}
		private var _progress:Number;
		
		/**
		 * Eventos dos objetos FileLoader e FileUploader.
		 * @param	type
		 * @param	fileName
		 * @param	bubbles
		 * @param	cancelable
		 */
		public function FileEvent(type:String, fileName:String = null, progress:Number = 0, bubbles:Boolean = false, cancelable:Boolean = false):void
		{
			super(type, bubbles, cancelable);
			_fileName = fileName;
			_progress = progress;
		}
		
		/**
		 * 
		 * @return FileEvent
		 */
		public override function clone():Event
		{
			return new FileEvent(type, fileName, progress, bubbles, cancelable);
		}
			
		/**
		 * 
		 * @return String
		 */
		public override function toString():String
		{
			return formatToString("FileEvent", "type", "fileName", "progress", "bubbles", "cancelable", "eventPhase");
		}
		
	}
	
}